﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.Area.Monthcard;
using LJX.SmartPark.Domain.IotInfo.LightPoles;
using LJX.SmartPark.Service.Area;
using LJX.SmartPark.Service.Repository;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.Area.MonthcardServeice;
using static LJX.SmartPark.Service.IotInfo.LightPoles.LightPolesServeice;

namespace LJX.SmartPark.WebApi.Controllers.Area
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "Area")]
    public class MonthcardController : ControllerBase
    {
        private readonly IMonthcardServeice _monthcardServeice;

        public MonthcardController(IMonthcardServeice monthcardServeice)
        {
            _monthcardServeice = monthcardServeice;
        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _monthcardServeice.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<Monthcard>> GetMonthcardAsync(FYMonthcard fYMonthcard)
        {
            var result = _monthcardServeice.GetMonthcardAsync(fYMonthcard);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<Monthcard> GetMonthcardById(Monthcard input)
        {
            var student = _monthcardServeice.GetMonthcardById(input);
            return student;
        }
    }
}
